<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">

	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
	<title>通知详情</title>
	<link rel="stylesheet" href="css/main.css">
	<link rel="stylesheet" href="./student/css/head.css">
	<link rel="stylesheet" href="css/school_notice.css">
	<style scoped>
		[v-cloak] {
			display: none;
		}

		.notice_center {
			width: 96%;
			margin: 15px 2%;
			border-radius: 6px;
			background-color: white;
			padding-bottom: 40px;
		}

		.img_box {
			width: 96%;
			margin: 5px 2%;
			height: auto !important;
		}

		.info_header {
			padding-top: 10px;
			padding-bottom: 0;
		}

		.department {
			text-align: right;
		}

		.notice_publisher {
			font-size: 15px;
			float: right;
			width: calc(100% - 3em);
			text-align: right;
			margin-right: 1.5em;
		}

		.notice_time {
			float: right;
			font-size: 12px;
			float: right;
			width: calc(100% - 3em);
			text-align: right;
			margin-right: 1.5em;
		}
	</style>
</head>

<body>
	<div id="container" >
		<div class="contain ">
			<div class="header">
				<div class="header_title">通知详情</div>
				<a onclick="history.back()">
					<img src="image/return.png" alt="" class="return">
				</a>
			</div>
			<div style="height: 40px;"></div>
			<div class="notice_center" id="vue-root" v-cloak>
				<div class="info_header">
					<h3>标题：{{notice.title}}</h3>
				</div>
				<div class="img_box" v-if="notice.pic">
					<img class="notice_img" :src="getImg(notice)" />
				</div>
				<div class="info_center" v-html="notice.content"></div>
				<div class="info_foot">
					<div class="notice_publisher">发布人：{{notice.publisher}}</div>
					<div class="notice_time" v-text="notice.time"></div>
				</div>
			</div>
		</div>
	</div>

	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	<script src="/scriptZIP/axios.min.js"></script>
	<script src="/wechat/js/wx.js"></script>

	<script src="/js/common.js"></script>

	<script>
		var app = new Vue({
			el: '#vue-root',
			data: {
				notice: {},
			},
			created: function () {
				var user = params().user;
				this.prefix = (user ? user == 'teacher' : isTeacher()) ? '/t' : '/s';
				this.getData();
			},
			methods: {
				getData: function () {
					var id = params().id;
					axios.get(this.prefix + '/notice/' + id).then(function (res) {
						this.notice = res.data;

						this.$nextTick(function () {
							bindPreview();
						});
					}.bind(this));
					axios.post(this.prefix + '/notice/read/' + id).then(function (res) {
						console.log('阅');
					});
				},
				getImg: function (notice) {
					return '/static/' + notice.schoolId + '/notice/' + notice.pic;
				},

			}
		});

	</script>

</body>

</html>